import { IParam } from "@/core";
{{#* inline 'getAllCodeItems' psCodeItems pvalue}}
{{#each psCodeItems as |codeItem|}}
{{#if codeItem.psCodeItems}}
{{> getAllCodeItems psCodeItems=codeItem.psCodeItems pvalue=codeItem.value}}
{{/if}}
{{#codeItem}}
{'value': {{#if appCodeList.codeItemValueNumber}}{{value}}{{else}}'{{value}}'{{/if}},{{#if pvalue}}'pvalue': '{{pvalue}}',{{/if}} 'text': '{{text}}','codeName': '{{codeName}}', {{#if data}}'data': {{data}},{{/if}}{{#if userData}}'userData': '{{userData}}',{{/if}}{{#if color}}'color': '{{color}}', {{/if}}'disable':{{disableSelect}} ,'textResTag':'{{#if textPSLanguageRes.lanResTag}}{{textPSLanguageRes.lanResTag}}{{/if}}','textClass': '{{#if textCls}}{{textCls}}{{else if psSysCss}}{{psSysCss.cssName}}{{/if}}',{{#if psSysImage}}{{#if psSysImage.cssClass}}'cssClass': '{{psSysImage.cssClass}}',{{/if}}{{#if psSysImage.imagePath}}'imagePath': '{{psSysImage.imagePath}}'{{/if}}{{/if}} },
{{/codeItem}}
{{/each}}
{{/inline}}
function getAppCodeListConfig():IParam {
    return {
    {{#each app.allPSAppCodeLists as |appCodeList|}}
        '{{appCodeList.codeListTag}}':{
            'name': '{{appCodeList.name}}',
            'codeName': '{{appCodeList.codeName}}',
            'codeListTag': '{{appCodeList.codeListTag}}',
            'codeListType': '{{appCodeList.codeListType}}',
            'isEnableCache': {{appCodeList.enableCache}},
            'cacheTimeout': {{appCodeList.cacheTimeout}},
            {{~#if appCodeList.minorSortDir}}'minorSortDir': '{{appCodeList.minorSortDir}}',{{/if~}}
            {{~#if appCodeList.minorSortPSAppDEField}}'minorSortPSAppDEField': '{{lowerCase appCodeList.minorSortPSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.predefinedType}}'predefinedType': '{{appCodeList.predefinedType}}',{{/if~}}
            {{~#if appCodeList.psAppDataEntity}}'appDataEntity': '{{appCodeList.psAppDataEntity.codeName}}',{{/if~}}
            {{~#if appCodeList.psAppDEDataSet}}'appDEDataSet': '{{appCodeList.psAppDEDataSet.codeName}}',{{/if~}}
            {{~#if appCodeList.textPSAppDEField}}'textPSAppDEField': '{{lowerCase appCodeList.textPSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.valuePSAppDEField}}'valuePSAppDEField': '{{lowerCase appCodeList.valuePSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.pValuePSAppDEField}}'pValuePSAppDEField': '{{lowerCase appCodeList.pValuePSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.disablePSAppDEField}}'disablePSAppDEField': '{{lowerCase appCodeList.disablePSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.iconPathPSAppDEField}}'iconPathPSAppDEField': '{{lowerCase appCodeList.iconPathPSAppDEField.codeName}}',{{/if~}}
            {{~#if appCodeList.iconClsPSAppDEField}}'iconClsPSAppDEField': '{{lowerCase appCodeList.iconClsPSAppDEField.codeName}}',{{/if}}
            'emptyText': '{{appCodeList.emptyText}}',
            {{#if appCodeList.psCodeItems}}
            'items':[
                {{> getAllCodeItems psCodeItems=appCodeList.psCodeItems}}
            ]
            {{/if}}
        }{{#unless @last}},{{/unless}}
    {{/each}}
    }
}
export const AppCodeListConfig = getAppCodeListConfig();